#ifndef SONGDOWNLOADHTTP_H
#define SONGDOWNLOADHTTP_H

#include <QObject>
#include "http/ezqhttp.h"
#include "songmodel.h"

class SongDownLoadHttp : public EZQHTTPNS::EZQHttp
{
    Q_OBJECT
protected:
    virtual ~SongDownLoadHttp();
public:
    explicit SongDownLoadHttp();

    void setDownLoadPath(const QString &downLoadPath);
    void startAsync();

    SongModel *song() const;
    void setSong(SongModel *song);

    bool cancelOnUnCite() const;
    void setCancelOnUnCite(bool cancelOnUnCite);

    virtual void Release();
private:
    bool _cancelOnUnCite;//在没有引用时,stop download

    void startSync();
    void setNeedProgress(bool isNeed);
protected:

    bool _willStart;
//    QString query
    QString bestQualityKey();

    SongModel *_song;
    QMutex _mutex;
private:

signals:

protected slots:
    void OnSongGetUrl(QString &key,int error);
public slots:
    void cancel();


};

#endif // SONGDOWNLOADHTTP_H
